﻿/**
* @file main.cpp
* @describe 程序入口文件
* @author gaoyuelong
* @date 2021/11/23
*/

#include "qomain.h"
#include "qologin.h"

#include <QApplication>
#include <QFile>
#include <QTextStream>
#include <QTextCodec>
#include <QTranslator>

int main(int argc, char *argv[])
{
    QApplication qo(argc, argv);

    //中文乱码
    QTextCodec *pCodec = QTextCodec::codecForName("utf-8");
    QTextCodec::setCodecForLocale(pCodec);

    //qss
    QFile fileQss(":/new/prefix/qss/qo.qss");
    if(fileQss.open(QIODevice::ReadOnly))
    {
        QTextStream in(&fileQss);
        qo.setStyleSheet(in.readAll());
    }

    //国际化翻译
    QTranslator translator;
    translator.load("en_to_zh.qm", ":/new/prefix/qm/");
    qo.installTranslator(&translator);

    //登录页面
    QoLogin qoLogin;
    if (qoLogin.exec() == QDialog::Rejected) {
        return 0;
    }

    //主页面
    QoMain qoMain;
    qoMain.show();

    return qo.exec();
}
